package goods

// Goods 商品模型
type Goods struct {
	Id          int    `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
	Name        string `json:"name" gorm:"type:varchar(255);not null;comment:商品标题"`
	Description string `json:"description" gorm:"type:text;comment:商品介绍"`
	Image       string `json:"image" gorm:"type:varchar(500);comment:商品图片URL"`
	Points      int    `json:"points" gorm:"type:int;not null;default:0;comment:消耗积分"`
	Stock       int    `json:"stock" gorm:"type:int;not null;default:0;comment:库存数量"`
	Status      int    `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:是否上架：1上架，0下架"`
	CreateTime  string `gorm:"column:create_time" json:"create_time" form:"create_time"`
	UpdateTime  string `gorm:"column:update_time" json:"update_time" form:"update_time"`
	DeleteTime  *string `gorm:"column:delete_time" sql:"index" json:"-"`
}

// TableName 设置表名
func (Goods) TableName() string {
	return "goods"
}

// GetId 获取商品ID
func (e *Goods) GetId() interface{} {
	return e.Id
}